package work.xiaohong.gupiao.pojo;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

import static io.swagger.v3.oas.annotations.media.Schema.AccessMode.READ_ONLY;

@Schema(name = "Jijin")
public class Jijin implements Serializable{


    @TableField(exist = false )
	private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");

    @TableId(value = "id",type = IdType.AUTO)
    @Schema(description = "主键ID",accessMode = READ_ONLY)
    @JsonFormat(shape = JsonFormat.Shape.STRING)
	private Integer id;//主键ID

    @Schema(description = "基金代码")
    @TableField("code")
	private String code;//基金代码

	@Schema(description = "基金名称")
	@TableField("name")
	private String name;//基金名称

    @Schema(description = "买进日期")
    @TableField("buyDay")
	private Date buyDay;//买进日期

	@Schema(description = "买进日期字符串类型")
	@TableField(exist = false)
	private String buyDayStr;//买进日期字符串类型

    @Schema(description = "买进金额")
    @TableField("buyMoney")
	private String buyMoney;//买进金额

	@Schema(description = "买进净值")
	@TableField("buyPrice")
	private String buyPrice;//买进净值

    @Schema(description = "买进份额")
    @TableField("buyNumber")
	private String buyNumber;//买进份额

	@Schema(description = "距离可赎天数")
	@TableField("freeDay")
	private Integer freeDay; //距离可赎天数

    @Schema(description = "卖出价格")
    @TableField("sellMoney")
	private String sellMoney;//卖出价格

    @Schema(description = "卖出净值")
    @TableField("sellPrice")
	private String sellPrice;//卖出净值

    @Schema(description = "卖出时间")
    @TableField("sellDay")
    private Date sellDay;//卖出时间

    @Schema(description = "交易完成时间")
    @TableField("dealDay")
    private Date dealDay;//交易完成时间

	@Schema(description = "交易完成时间字符串类型")
	@TableField(exist = false)
	private String dealDayStr;//交易完成时间字符串类型

	@Schema(description = "卖出时间字符串类型")
	@TableField(exist = false)
	private String sellDayStr;//卖出时间字符串类型

	@Schema(description = "买入状态（0 买入中 1 已买入 3 卖出中 4 已卖出 5 已撤回）")
	@TableField("status")
	private Integer status;//买入状态（0 买入中 1 已买入 2 卖出中 3 已卖出 4 已撤回）

	@Schema(description = "创建时间",accessMode = READ_ONLY)
	@TableField(value = "gmt_create",fill = FieldFill.INSERT)
	private Date gmtCreate;//创建时间

	@Schema(description = "更改时间",accessMode = READ_ONLY)
	@TableField(value = "gmt_modified",fill = FieldFill.INSERT_UPDATE)
	private Date gmtModified;//更改时间

	@Schema(description = "创建时间字符串",accessMode = READ_ONLY)
	@TableField(exist = false)
	private String gmtCreateStr;//创建时间字符串

	@Schema(description = "更改时间字符串",accessMode = READ_ONLY)
	@TableField(exist = false)
	private String gmtModifiedStr;//更改时间字符串

	@Schema(description = "乐观锁",accessMode = READ_ONLY)
	@Version
	private Integer version;//乐观锁

	@Schema(description = "逻辑删除标志",accessMode = READ_ONLY)
	@TableLogic
	private Integer deleted;//逻辑删除标志

	@TableField(exist = false)
	private Integer isIdea; // 是否建议卖出(0不建议 1建议卖出)

	@TableField(exist = false)
	private Float profit; // 预计盈亏

	@Override
	public String toString() {
		return "Jijin{" +
				"simpleDateFormat=" + simpleDateFormat +
				", id=" + id +
				", code='" + code + '\'' +
				", name='" + name + '\'' +
				", buyDay=" + buyDay +
				", buyDayStr='" + buyDayStr + '\'' +
				", buyMoney='" + buyMoney + '\'' +
				", buyPrice='" + buyPrice + '\'' +
				", buyNumber='" + buyNumber + '\'' +
				", freeDay=" + freeDay +
				", sellMoney='" + sellMoney + '\'' +
				", sellPrice='" + sellPrice + '\'' +
				", sellDay=" + sellDay +
				", dealDay=" + dealDay +
				", dealDayStr='" + dealDayStr + '\'' +
				", sellDayStr='" + sellDayStr + '\'' +
				", status=" + status +
				", gmtCreate=" + gmtCreate +
				", gmtModified=" + gmtModified +
				", gmtCreateStr='" + gmtCreateStr + '\'' +
				", gmtModifiedStr='" + gmtModifiedStr + '\'' +
				", version=" + version +
				", deleted=" + deleted +
				", isIdea=" + isIdea +
				", profit=" + profit +
				'}';
	}

	public String getDealDayStr() {
		if (dealDay != null ){
			return simpleDateFormat.format(dealDay);
		}else {
			return dealDayStr;
		}
	}

	public void setDealDayStr(String dealDayStr) {
		this.dealDayStr = dealDayStr;
	}

	public Date getDealDay() {
        return dealDay;
    }

    public void setDealDay(Date dealDay) {
        this.dealDay = dealDay;
    }


    public String getBuyDayStr() {
    	if (buyDay != null ){
			return simpleDateFormat.format(buyDay);
		}else {
    		return buyDayStr;
		}

	}

	public void setBuyDayStr(String buyDayStr) {
		this.buyDayStr = buyDayStr;
	}

	public String getSellDayStr() {
		if (sellDay != null ){
			return simpleDateFormat.format(sellDay);
		}else {
			return sellDayStr;
		}

	}

	public void setSellDayStr(String sellDayStr) {
		this.sellDayStr = sellDayStr;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getBuyDay() {
		return buyDay;
	}

	public void setBuyDay(Date buyDay) {
		this.buyDay = buyDay;
	}

	public String getBuyMoney() {
		return buyMoney;
	}

	public void setBuyMoney(String buyMoney) {
		this.buyMoney = buyMoney;
	}

	public String getBuyPrice() {
		return buyPrice;
	}

	public void setBuyPrice(String buyPrice) {
		this.buyPrice = buyPrice;
	}

	public String getBuyNumber() {
		return buyNumber;
	}

	public void setBuyNumber(String buyNumber) {
		this.buyNumber = buyNumber;
	}

	public Integer getFreeDay() {
		return freeDay;
	}

	public void setFreeDay(Integer freeDay) {
		this.freeDay = freeDay;
	}

	public String getSellMoney() {
		return sellMoney;
	}

	public void setSellMoney(String sellMoney) {
		this.sellMoney = sellMoney;
	}

	public String getSellPrice() {
		return sellPrice;
	}

	public void setSellPrice(String sellPrice) {
		this.sellPrice = sellPrice;
	}

	public Date getSellDay() {
		return sellDay;
	}

	public void setSellDay(Date sellDay) {
		this.sellDay = sellDay;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Date getGmtCreate() {
		return gmtCreate;
	}

	public void setGmtCreate(Date gmtCreate) {
		this.gmtCreate = gmtCreate;
	}

	public Date getGmtModified() {
		return gmtModified;
	}

	public void setGmtModified(Date gmtModified) {
		this.gmtModified = gmtModified;
	}

	public String getGmtCreateStr() {
		return simpleDateFormat.format(gmtCreate);
	}

	public void setGmtCreateStr(String gmtCreateStr) {
		this.gmtCreateStr = gmtCreateStr;
	}

	public String getGmtModifiedStr() {
		return simpleDateFormat.format(gmtModified);
	}

	public void setGmtModifiedStr(String gmtModifiedStr) {
		this.gmtModifiedStr = gmtModifiedStr;
	}

	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	public Integer getDeleted() {
		return deleted;
	}

	public void setDeleted(Integer deleted) {
		this.deleted = deleted;
	}

	public Integer getIsIdea() {
		return isIdea;
	}

	public void setIsIdea(Integer isIdea) {
		this.isIdea = isIdea;
	}

	public Float getProfit() {
		return profit;
	}

	public void setProfit(Float profit) {
		this.profit = profit;
	}
}
